
#include <stdio.h>
void swap(int* p, int* q)
{
    int tmp = *p;
    *p = *q;
    *q = tmp;




}
int findContentChildren(int* g, int gSize, int* s, int sSize) {
    for (int i = 0; i < gSize - 1; i++)
    {
        for (int j = 0; j < gSize - 1 - i; j++)
        {
            if (g[j + 1] < g[j])
            {
                swap(&g[j + 1],&g[j]);
                
            }

        }





    }
    for (int i = 0; i < sSize - 1; i++)
    {
        for (int j = 0; j < sSize - 1 - i; j++)
        {
            if (s[j + 1] < s[j])
            {
                swap(&s[j + 1], &s[j]);
            }

        }





    }





    int count = sSize - 1;
    int num = 0;
    for (int i = gSize - 1; i >= 0; i--)
    {
        if (s[count] >= g[i])
        {
            count--;
            num++;


        }
    }
    return num;

}
int main()
{

    int grr[] = { 3,2,1 };
    int srr[] = { 1,1 };
    int ret=
        findContentChildren(grr, 3, srr, 2);
    printf("%d ", ret);
}